package com.scau.classOnline.common;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {
    String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};

    public static int getWeekOfDay(Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        System.out.println(new Date());
        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
        if (w < 0) {
            w = 0;
        }
        return w;
    }

    public static Date getDay(int offset){
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE,offset);
        return calendar.getTime();
    }
}
